<%@ page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body background="images/modify.jpg">

<center>
<font size =5>
<p>查看预案列表
<P>
<a href="main.jsp"> 主页面</a>
</font>
<form action ="search.jsp" method= post>
<input type="text" name="id" size='20' maxlength="20" placeholder="请输入您要查询预案的编号"><br><br>
<button type="submit">查询</button>

<button type="submit"><a href="guanli.jsp">返回</button>

</form>
</center>

<%
Connection con = null;
Statement st = null;
ResultSet rs =null;
try{
	Class.forName("com.mysql.jdbc.Driver");
	con = DriverManager.getConnection("jdbc:mysql://localhost:3306/1","root","lishanshan");
	st = con.createStatement();
	rs = st.executeQuery("select * from person");
%>

<br/>
<br/>
<table border="1" width="100%" cellpadding ="2" cellspacing="1">
<tr>

<td width="5%">预案编号</td>
<td width="5%">预案名称</td>
<td width="5%">灾害类型</td>
<td width="5%">适用人员</td>
<td width="5%">预案发布时间</td>
<td width="70%">预案内容</td>
<td width="5%">操作</td>
</tr>

<%
int a=0;
while(rs.next()){
	a=a+1;
	int id = rs.getInt("id");
	String name = rs.getString("name");
	String label= rs.getString("label");
	String identity = rs.getString("identity");
	Date birthday = rs.getDate("birthday");
	String descriptions = rs.getString("descriptions");
	out.println("<tr>");
	%>
	
	<% 
	out.println("<td>"+id+"</td>");
	out.println("<td>"+name+"</td>");
	out.println("<td>"+label+"</td>");
	out.println("<td>"+identity+"</td>");
	out.println("<td>"+birthday+"</td>");
	out.println("<td>"+descriptions+"</td>");
	out.println("<td><a href=\"modify.jsp?id="+id+"\">修改</a>&nbsp;&nbsp;");
out.println("</tr>");
}
%>

</table>

<%
}catch(SQLException e){
	e.printStackTrace();
}finally{
	try{
		rs.close();
		st.close();
		con.close();
	}catch (SQLException e){
		e.printStackTrace();
	}
}
%>

</body>
</html>